/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MOM;

import java.util.ArrayList;

/**
 *
 * @author Huy
 */
public class Topic {
	public int id;
	public ArrayList<Subcriber> subcribers=new ArrayList<>();
	/*public void setId(int id);
	public int getId();*/

	public Topic(int id) {
		this.id = id;
	}
	
	public void subcribe(Subcriber sub)
	{
		subcribers.add(sub);
	}
	public void post(Message msg)
	{
		for (Subcriber subcriber : subcribers) {
			subcriber.notify(msg);
		}
	}
	/*{
		//subcribers.add(sub);
	}*/
}
